package com.tech.security.securityservice.controller;

import com.tech.security.securityservice.model.LoginUser;
import com.tech.security.securityservice.result.Result;
import com.tech.security.securityservice.service.UserService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RestController;

@RestController
public class LoginController {

    @Autowired
    private UserService userService;

    @PostMapping("/user/login")
    public Result<LoginUser> login(@RequestBody LoginUser user){
        LoginUser login = userService.login(user);
        return Result.Success(login);
    }

}
